package cn.gong.jizhang.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

public class CollectionUtils {
	public static <E> boolean isEmpty(Collection<E> collection) {
		if (collection != null && collection.size() > 0) {
			return false;
		} else {
			return true;
		}
	}
	
	public static <E> boolean isNotBlank(Collection<E> collection) {
		return !isEmpty(collection);
	}
	
	public static <T> ArrayList<T> setToArrayList(Set<T> set) {
		if (set != null) {
			ArrayList<T> list = new ArrayList<T>();
			Iterator<T> iterator = set.iterator();
			while (iterator.hasNext()) {
				T instance = iterator.next();
				list.add(instance);
			}
			return list;
		} else {
			return new ArrayList<T>();
		}
	}
}
